﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLM.Domain.Model;
using DLM.Domain.Repositories;
using DLM.Infrastructure.UnitOfWork;
using DLM.Infrastructure.Domain;
using Webdiyer.WebControls.Mvc;

namespace DLM.Data.EF.CodeFirst.Repositories
{
    public class PartyAlbumRepository : Repository<PartyAlbum, int>, IPartyAlbumRepository
    {
        public PartyAlbumRepository(IUnitOfWork unitOfWork):base(unitOfWork)
        {

        }

        public IEnumerable<PartyAlbum> FindByParty(int partyID)
        {
            return this.ActiveContext.PartyAlbum.Where(a => a.PartyID == partyID).ToList();
        }

        public new System.Collections.IEnumerator GetEnumerator()
        {
            throw new NotImplementedException();
        }


        public IEnumerable<PartyAlbum> FindByParty(int partyID, int pageIndex, int pageSize)
        {
            return this.ActiveContext.PartyAlbum.Where(a => a.PartyID == partyID).OrderByDescending(a=>a.CreateDate).ToPagedList(pageIndex, pageSize);
        }
    }
}
